package sky.tags;

import javax.servlet.ServletException;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.tagext.TagSupport;
import java.io.IOException;
import java.util.Map;

/**
 * Created with IntelliJ IDEA.
 * User: Gauss
 * Date: 05.05.13
 * Time: 15:16
 * To change this template use File | Settings | File Templates.
 */
public class IncludeTag extends TagSupport {
    protected Map<String, Object> attr1;
    protected String url;

    @Override
    public int doStartTag() throws JspException {
        //pageContext.setAttribute("parameters", attr1);
        try {
            pageContext.include(url);
        } catch (ServletException e) {
            throw new JspException();
        } catch (IOException e) {
            throw new JspException();
        }
        return SKIP_BODY;
    }

    public Map<String, Object> getAttr1() {
        return attr1;
    }

    public void setAttr1(Map<String, Object> attr1) {
        this.attr1 = attr1;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }
}
